package com.pay.familycar.presenter;

import com.pay.familycar.api.ApiRetrofit;
import com.pay.familycar.base.BasePresenter;
import com.pay.familycar.response.NVHPRankResponse;
import com.pay.familycar.view.Car_HomeView;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * @author aichonghui
 * @date 2019/3/28.
 */
public class Car_HomePresenter extends BasePresenter<Car_HomeView> {

    public Car_HomePresenter(Car_HomeView view) {
        super(view);
    }

    public void getNVHPRank(){
        mApiService.getHPRankToday().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<NVHPRankResponse>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        System.out.println("请求失败"+e);
                      mView.onVDHomeHistorystatusError();
                    }

                    @Override
                    public void onNext(NVHPRankResponse nvhpRankResponse) {
                       mView.onVDHomeHistorystatusSuccess(nvhpRankResponse);
                    }
                });
    }
}
